#include "ImageLoader.h"
#include <qfiledialog.h>
#include "InitChooseDialog.h"

using namespace std;

ImageLoader::ImageLoader()
{
}

void ImageLoader::load()
{

    QFileDialog dialog(NULL);

    dialog.setAcceptMode(QFileDialog::AcceptOpen);
    dialog.setNameFilter("Images (*.png *.jpg *.bmp *.gif)");
    dialog.setViewMode(QFileDialog::List);
    dialog.setFileMode(QFileDialog::ExistingFiles);

    if (dialog.exec())
    {
        if ( dialog.selectedFiles().size() > 1 )
        {
            QStringList list = dialog.selectedFiles();

            for(int i=0; i < list.size(); i++)
            {
                m_files.append(list[i]);
            }

            // showing the initial setup dialog!

            InitChooseDialog initDialog(NULL, m_files);

            if ( initDialog.exec() )
            {
                m_initials = initDialog.getChoice();
            }
        }
        else
        {
            // show error // no need for now
        }
    }
}
